import request from '@/utils/request'

// 查询政策法规列表
export function listStatute(query) {
  return request({
    url: '/system/statute/list',
    method: 'get',
    params: query
  })
}

// 查询政策法规详细
export function getStatute(policyId) {
  return request({
    url: '/system/statute/' + policyId,
    method: 'get'
  })
}

// 新增政策法规
export function addStatute(data) {
  return request({
    url: '/system/statute',
    method: 'post',
    data: data
  })
}

// 修改政策法规
export function updateStatute(data) {
  return request({
    url: '/system/statute',
    method: 'put',
    data: data
  })
}

// 删除政策法规
export function delStatute(policyId) {
  return request({
    url: '/system/statute/' + policyId,
    method: 'delete'
  })
}

// 导出政策法规
export function exportStatute(query) {
  return request({
    url: '/system/statute/export',
    method: 'get',
    params: query
  })
}

// 查询下拉树结构
export function treeselect() {
  return request({
    url: '/system/statute/treeselect',
    method: 'get'
  })
}

// 置顶修改
export function changeTop(policyId, istop) {
  const data = {
    policyId,
    istop
  }
  return request({
    url: '/system/statute/changeTop',
    method: 'put',
    data: data
  })
}

//下载文件
export function getFile (url){
  return request({
    url: url,
    method: 'get',
    responseType: 'arraybuffer'
  })
}

